package org.game.db.proxy.bean;

import com.google.common.collect.Sets;
import org.game.db.bean.Formation;

import com.sojoys.artifact.build.data.base.BasePojoProxy;
import org.game.db.bean.Hero;
import org.game.db.bean.Role;
import org.game.db.cache.HeroCache;

import java.util.List;
import java.util.Set;

/**
 * @author : DengYing
 * @CreateDate : 2017年11月30日 下午2:27:36
 * @Description ：阵型扩展
 */
public class FormationProxy extends BasePojoProxy<FormationProxy, Formation>{

    /**
     * 获取阵型对应的精灵列表
     */
    public Set<Role> getRoles(){
        Set<Role> roles = Sets.newHashSet();
        List<Long> heroIds = t.getStance();
        for (Long heroId : heroIds) {
            if (heroId==null || 0 == heroId) {
                continue;
            }
            Hero hero = HeroCache.me().getById(heroId);
            Role role = hero.getHeroProxy().getRelevantRole();
            if (role == null){
                continue;
            }
            roles.add(role);
        }
        return roles;
    }
}
